package hr.koshnica.android.database;

import android.app.SearchManager;
import android.net.Uri;
import android.provider.BaseColumns;

public class KoshnicaContract {

	interface LocationsColumns{
		String LOC_NAME = "loc_name";
	    
		String LOC_DESC = "loc_desc";
	    
		String LOC_GENRE = "loc_genre";
	    
		String LOC_STATUS = "loc_status"; //{'FAVORITE', 'NEUTRAL', 'DISLIKE'}
	    
		String LOC_LIKE = "loc_like"; //NUMBER OF LIKES
		
	}
	
	interface EventsColumns{
		
		String EVENT_NAME = "event_name";
		
		String EVENT_DESC = "event_desc";

		String EVENT_GENRE = "event_genre";
		
		String EVENT_STATUS = "event_status"; //{'FAVORITE', 'NEUTRAL', 'DISLIKE'}
		
		String EVENT_LIKE = "event_like"; //NUMBER OF LIKES
		
		String EVENT_PRICE = "event_price";
		
		String EVENT_CLUB_NAME = "event_club_name"; //PROBABLY LATER CLUB_ID INSTEAD OF CLUB_NAME
		
	}
	
	interface SearchColumns {
		
        String _ID = "_id";

        String TITLE = SearchManager.SUGGEST_COLUMN_TEXT_1;

        String OVERVIEW = SearchManager.SUGGEST_COLUMN_TEXT_2;
        
        String DATA_ID = SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID;
        
        String EXTRA_DATA = SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA;
        
    }
	
	public static final String CONTENT_AUTHORITY = "hr.koshnica.android";

	private static final Uri BASE_CONTENT_URI = Uri.parse("content://" + CONTENT_AUTHORITY);

	public static final String PATH_LOCATIONS = "locations";

	public static final String PATH_EVENTS = "events";

	public static final String PATH_SEARCH = "search";
	
	
	public static class Locations implements LocationsColumns, BaseColumns {
		public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
				.appendPath(PATH_LOCATIONS).build();
		
		public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.koshnica.location";
		
		public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.koshnica.location";
		
		public static Uri buildLocationUri(String locationId) {
			return CONTENT_URI.buildUpon().appendPath(locationId).build();
		}
		
		public static String getLocationId(Uri uri) {
			return uri.getLastPathSegment();
		}
	}
	
	public static class Events implements EventsColumns, BaseColumns {
		public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
				.appendPath(PATH_EVENTS).build();
		
		public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.koshnica.event";
		
		public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.koshnica.event";
		
		public static Uri buildEventUri(String eventId) {
			return CONTENT_URI.buildUpon().appendPath(eventId).build();
		}
		
		public static String getEventId(Uri uri) {
			return uri.getLastPathSegment();
		}

	}
	
	public static class Search implements SearchColumns {
		public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
				.appendPath(PATH_SEARCH).build();
		
		public static Uri buildDocIdUri(String rowId) {
			return CONTENT_URI.buildUpon().appendPath(rowId).build();
		}
		
		public static String getDocId(Uri uri) {
			return uri.getLastPathSegment();
		}
	}
	
	private KoshnicaContract() {
	}
}
